import useMapper from './useMapper'
import { mapGetters, createNamespacedHelpers } from 'vuex'
export default function (moduleName, mapper) {
  let myMapGetters = mapGetters
  if (typeof moduleName === 'string' && moduleName.length !== 0) {
    myMapGetters = createNamespacedHelpers(moduleName).mapGetters
  } else { // 如果moduleName没有传入，则只有一个参数，也就是要传入的数组或者对象
    mapper = moduleName
  }
  return useMapper(mapper, myMapGetters)
}
